package com.java.module.system.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.java.common.utils.AssertKit;
import com.java.common.utils.bean.BeanUtils;
import com.java.module.system.domain.Region;
import com.java.module.system.domain.dto.RegionDTO;
import com.java.module.system.mapper.RegionMapper;
import com.java.module.system.service.IRegionService;

/**
 * 地区Service业务层处理
 * 
 * @author Administrator
 * @date 2021-07-07
 */
@Service
public class RegionServiceImpl implements IRegionService {

    @Autowired
    private RegionMapper regionMapper;

    /**
     * 查询地区列表
     * 
     * @param region 地区
     * @return 地区
     */
    @Override
    public List<Region> selectRegionList(RegionDTO regionDTO) {
        if (regionDTO.getRegionType() > 1) {
            AssertKit.notNull(regionDTO.getParentId(), "上级ID不能为空");
        }
        Region region = new Region();
        BeanUtils.copyBeanProp(region, regionDTO);
        return regionMapper.selectRegionList(region);
    }

}